{% extends '@Admin/adminFramework/example/edit.html.twig' %}
{% import '@Admin/adminFramework/config.html.twig' as config %}


{% block title %}角色管理{% endblock %}
{% block input %}
<div class="row" style="margin-left: 5px">
    <div class="span5">
        Avaliable:
        <input id="search-avaliable"><br>
        <select id="list-avaliable" multiple size="20" style="width: 100%; margin-top: 5px">
        </select>
    </div>
    <div class="span1">
        <br><br><br>
        <a href="#" id="btn-add" class="btn btn-success">&gt;&gt;</a><br>
        <a href="#" id="btn-remove" class="btn btn-danger">&lt;&lt;</a>
    </div>
    <div class="span5">
        Assigned:
        <input id="search-assigned"><br>
        <select id="list-assigned" multiple size="20" style="width: 100%; margin-top: 5px">
        </select>
    </div>
</div>
{% endblock %}

{% block button %}
{% endblock %}

{% block before %}
    {{ loader_model.load_navigation('角色管理', '权限管理', { '角色管理':'' }) }}
{% endblock %}
{% block jquery %}
    {{ parent() }}
    <script type="text/javascript" src="{{ asset('bundles/admin/js/permission.js') }}"></script>
    <script>
        jQuery(document).ready(function () {
            permission.initProperties({"roleName": "{{ item.name }}", "assignUrl": "{{ path('admin_role_assign') }}", "searchUrl": "{{ path('admin_permission_search') }}"});

            $('#search-avaliable').keydown(function () {
                permission.searchRole('avaliable');
            });
            $('#search-assigned').keydown(function () {
                permission.searchRole('assigned');
            });
            $('#btn-add').click(function () {
                permission.addChild('assign');
                return false;
            });
            $('#btn-remove').click(function () {
                permission.addChild('remove');
                return false;
            });

            permission.searchRole('avaliable', true);
            permission.searchRole('assigned', true);
        });
    </script>
{% endblock %}